﻿a@echo off

::服务器数据库 用户名 密码
set suser=root
set suserpwd=zhypgy@996
::mysql 二进制日志文件存放的位置
set filePath=D:\mysql\Data


::当前系统日期 
set now=%DATE:~0,4%%DATE:~5,2%%DATE:~8,2%

::备份文件夹
set backup=E:\backup
if not exist %backup% md %backup%

::以日期命名的文件夹
set nowfile=%backup%\%now%-Increase
if not exist %nowfile% md %nowfile%

::前一次日志文件名
set logbin=%nowfile%\logbin.txt

mysql -u%suser% -p%suserpwd% -e "show master status"|findstr -B OA-TESTSERVER-bin.>%logbin%

::处理日志文件名  复制到目标文件夹
FOR /F "delims=	" %%i in (%logbin%) do  copy %filePath%\%%i %nowfile%

::刷新日志产生新的日志
mysqladmin -u%suser% -p%suserpwd% flush-logs
pause
exit@echo off
